package com.hop.thread;

/**
 * 创建Runnable实现类的实例，并以此实例作为Thread类的target来创建Thread对象，该Thread对象才是真正的线程对象
 * @author Administrator
 *
 */
public class RunnableTest {
	
	/**
	 * 测试接口
	 * @param args
	 */
	public static void main(String[] args){
		for(int i = 0; i<100; i++){
			System.out.println(Thread.currentThread().getName()+" "+i);
			if(i == 30){
				Runnable myRunnable = new MyRunnable();
				Thread t1 = new Thread(myRunnable);
				Thread t2 = new Thread(myRunnable);
				t1.start();
				t2.start();
			}
		}
	}
	
	
}
